<template>
  <div>
    <van-nav-bar
      fixed
      border
      :title="title"
      :left-text="left ? '返回' : ''"
      :left-arrow="left ? true : false"
      @click-left="onClickLeft"
      @click-right="onClickRight"
    >
      <template v-if="path" #right>
        <van-icon :name="icon || setting - o" size="18" />
      </template>
    </van-nav-bar>
  </div>
</template>

<script>
// import { Toast } from 'vant'

export default {
  name: 'Header',
  components: {},
  directives: {},
  filters: {},
  props: {
    title: { type: String, default: '.' },
    left: { type: Boolean, default: true },
    path: { type: String, default: undefined },
    icon: { type: String, default: undefined }
  },

  data() {
    return {}
  },

  computed: {},
  async created() {},

  methods: {
    onClickLeft() {
      // Toast('返回')
      if (this.left) {
        this.$router.back()
      }
    },
    onClickRight() {
      // Toast('按钮')
      if (this.path) {
        this.$router.push(this.path)
      }
    }
  }
}
</script>

<style type="text/css"></style>
